home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / msoftapp.zip / DIBLOOK.CPP < prev    next >
C/C++ Source or Header  |  1993-06-01  |  4KB  |  154 lines

  1. // diblook.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // QuickHelp and/or WinHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "diblook.h"
  15.  
  16. #include "mainfrm.h"
  17. #include "dibdoc.h"
  18. #include "dibview.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CDibLookApp
  27.  
  28. BEGIN_MESSAGE_MAP(CDibLookApp, CWinApp)
  29.     //{{AFX_MSG_MAP(CDibLookApp)
  30.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  31.     //}}AFX_MSG_MAP
  32.     // Standard file based document commands
  33.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  34.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  35.     // Standard print setup command
  36.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  37. END_MESSAGE_MAP()
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CDibLookApp construction
  41. // Place all significant initialization in InitInstance
  42.  
  43. CDibLookApp::CDibLookApp()
  44. {
  45. }
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // The one and only CDibLookApp object
  49.  
  50. CDibLookApp NEAR theApp;
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CDibLookApp initialization
  54.  
  55. BOOL CDibLookApp::InitInstance()
  56. {
  57.     // Standard initialization
  58.     //  (if you are not using these features and wish to reduce the size
  59.     // of your final executable, you should remove the following initialization
  60.  
  61.     SetDialogBkColor();        // set dialog background color
  62.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  63.  
  64.     // Register document templates which serve as connection between
  65.     //  documents and views.  Views are contained in the specified view
  66.  
  67.     AddDocTemplate(new CMultiDocTemplate(IDR_DIBTYPE,
  68.             RUNTIME_CLASS(CDibDoc),
  69.             RUNTIME_CLASS(CMySplitter), //CMDIChildWnd),        // standard MDI child frame
  70.             RUNTIME_CLASS(CDibView)));
  71.  
  72.     // create main MDI Frame window
  73.     CMainFrame* pMainFrame = new CMainFrame;
  74.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  75.         return FALSE;
  76.     pMainFrame->ShowWindow(m_nCmdShow);
  77.     pMainFrame->UpdateWindow();
  78.     m_pMainWnd = pMainFrame;
  79.  
  80.     // enable file manager drag/drop and DDE Execute open
  81.     m_pMainWnd->DragAcceptFiles();
  82.     EnableShellOpen();
  83.     RegisterShellFileTypes();
  84.  
  85.     // simple command line parsing
  86.     if (m_lpCmdLine[0] == '\0')
  87.     {
  88.         // create a new (empty) document
  89.         // OnFileNew();
  90.     }
  91.     else if ((m_lpCmdLine[0] == '-' || m_lpCmdLine[0] == '/') &&
  92.         (m_lpCmdLine[1] == 'e' || m_lpCmdLine[1] == 'E'))
  93.     {
  94.         // program launched embedded - wait for DDE or OLE open
  95.     }
  96.     else
  97.     {
  98.         // open an existing document
  99.         OpenDocumentFile(m_lpCmdLine);
  100.     }
  101.  
  102.  
  103.     return TRUE;
  104. }
  105.  
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CAboutDlg dialog used for App About
  108.  
  109. class CAboutDlg : public CDialog
  110. {
  111. public:
  112.     CAboutDlg() : CDialog(CAboutDlg::IDD)
  113.         {
  114.             //{{AFX_DATA_INIT(CAboutDlg)
  115.             //}}AFX_DATA_INIT
  116.         }
  117.  
  118. // Dialog Data
  119.     //{{AFX_DATA(CAboutDlg)
  120.         enum { IDD = IDD_ABOUTBOX };
  121.     //}}AFX_DATA
  122.  
  123. // Implementation
  124. protected:
  125.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  126.     //{{AFX_MSG(CAboutDlg)
  127.         // No message handlers
  128.     //}}AFX_MSG
  129.     DECLARE_MESSAGE_MAP()
  130. };
  131.  
  132. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  133. {
  134.     CDialog::DoDataExchange(pDX);
  135.     //{{AFX_DATA_MAP(CAboutDlg)
  136.     //}}AFX_DATA_MAP
  137. }
  138.  
  139. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  140.     //{{AFX_MSG_MAP(CAboutDlg)
  141.         // No message handlers
  142.     //}}AFX_MSG_MAP
  143. END_MESSAGE_MAP()
  144.  
  145. // App command to run the dialog
  146. void CDibLookApp::OnAppAbout()
  147. {
  148.     CAboutDlg aboutDlg;
  149.     aboutDlg.DoModal();
  150. }
  151.  
  152. /////////////////////////////////////////////////////////////////////////////
  153. // CDibLookApp commands
  154.